package com.quanyan.stadium.utils.demo.view;

/**
 * Created by xiaoxiao on 17/2/6.
 */
public class UseDemo {

   public static void main(String[] args){
       Singleton1 singleton = Singleton1.getInstance();
       System.out.println("饿汉模式----获取到当前对象:"+singleton.toString());

       Singleton2 singleton2 = Singleton2.getInstance();
       System.out.println("懒汉模式----获取到当前对象:"+singleton2.toString());

       Singleton3 singleton3 = Singleton3.getInstance();
       System.out.println("静态内部类----获取到当前对象:"+singleton3.toString());

       String singleton4Str = Singleton4.INSTANCE.getStr();
       System.out.println("枚举模式----获取到当前对象:"+singleton4Str);

       Singleton5 singleton5 = Singleton5.getInstance();
       System.out.println("双重锁定----获取到当前对象:"+singleton5.toString());
   }

}
